<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>MYMSGRO</title>
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	<link rel="stylesheet" type="text/css" href="css/meniu.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />

</h:head>
<h:body>

	<ui:include src="header.xhtml" />

	<h:panelGroup layout="block" id="content">

		<ui:include src="leftMenu.xhtml" />

		<h:panelGroup layout="block" id="contenRight">

			<h:panelGroup layout="block" id="header" style="margin-top: 20px;">
				<ul>
					<li id="selected"><a>Add employee</a></li>
				</ul>
			</h:panelGroup>

			<h:panelGroup layout="block" id="contentTab">
				<h:form id="formAddUser" enctype="multipart/form-data">
					<h:panelGrid columns="4">

						<h:outputText value="Username:" style="float: right" />
						<h:inputText id="inputUsername"
							value="#{confidentialEmployeeDTO.username}" required="true"
							requiredMessage="Can't be blank" styleClass="inputEmployee">
						</h:inputText>
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputUsername" style="color:red" />

						<h:outputText value="First name:" style="float: right" />
						<h:inputText id="inputFirstname"
							value="#{confidentialEmployeeDTO.firstname}" required="true"
							requiredMessage="Can't be blank" styleClass="inputEmployee" />
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputFirstname" style="color:red" />

						<h:outputText value="Last name:" style="float: right" />
						<h:inputText id="inputLastname"
							value="#{confidentialEmployeeDTO.lastname}" required="true"
							requiredMessage="Can't be blank" styleClass="inputEmployee" />
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputLastname" style="color:red" />

						<h:outputText value="Work email:" style="float: right" />
						<h:inputText id="inputWorkEmail" styleClass="inputEmployee"
							value="#{confidentialEmployeeDTO.workEmail}" required="true"
							validatorMessage="Email address is not valid"
							requiredMessage="Can't be blank">
							<f:validateRegex
								pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
						</h:inputText>
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputWorkEmail" style="color:red" />

						<h:outputText value="Date of birth:" style="float: right" />

						<p:calendar effect="explode"
							value="#{confidentialEmployeeDTO.dob}" readonlyInput="true"
							timeZone="#{calendarBean.timeZone}" navigator="true"
							mindate="1900-01-01" maxdate="#{calendarBean.dateNow}"
							required="true" requiredMessage="Can't be blank"
							pattern="yyyy-MM-dd" id="popupButtonCal1" />

						<h:outputText value="*" style="color:red"></h:outputText>

						<h:message for="popupButtonCal1" style="color:red" />



						<h:outputText value="Personal phone:" style="float: right" />
						<h:inputText id="inputPersonalPhone"
							value="#{confidentialEmployeeDTO.personalPhone}" required="true"
							validatorMessage="Phone number is not valid. It needs to be between 10 and 14 digits."
							requiredMessage="Can't be blank" styleClass="inputEmployee">
							<f:validateRegex pattern="^\d{10,14}$" />
						</h:inputText>
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputPersonalPhone" style="color:red" />

						<h:outputText value="Personal email:" style="float: right" />
						<h:inputText id="inputPersonalEmail"
							value="#{confidentialEmployeeDTO.personalEmail}" required="true"
							validatorMessage="Email address is not valid"
							requiredMessage="Can't be blank" styleClass="inputEmployee">
							<f:validateRegex
								pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
						</h:inputText>
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputPersonalEmail" style="color:red" />



						<h:outputText value="Employment date:" style="float: right" />

						<p:calendar effect="explode"
							value="#{confidentialEmployeeDTO.employmentDate}"
							readonlyInput="true" timeZone="#{calendarBean.timeZone}"
							required="true" requiredMessage="Can't be blank"
							pattern="yyyy-MM-dd" id="popupButtonCal2" />

						<h:outputText value="*" style="color:red"></h:outputText>

						<h:message for="popupButtonCal2" style="color:red" />



						<h:outputText value="Last medical check date:"
							style="float: right" />

						<p:calendar effect="explode"
							value="#{confidentialEmployeeDTO.medCheckUpDate}"
							mindate="1900-01-01" maxdate="#{calendarBean.dateNow}"
							readonlyInput="true" timeZone="#{calendarBean.timeZone}"
							pattern="yyyy-MM-dd" id="popupButtonCal3" />

						<h:outputText></h:outputText>

						<h:outputText></h:outputText>



						<h:outputText value="Employment type:" style="float: right" />
						<h:selectOneMenu id="inputEmploymentType"
							value="#{employeeBean.confidentialEmployeeDTO.employmentType}">
							<f:selectItem itemValue="CM" itemLabel="CM" />
							<f:selectItem itemValue="PFA" itemLabel="PFA" />
						</h:selectOneMenu>
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputEmploymentType" style="color:red" />

						<h:outputText value="Position:" style="float: right" />
						<h:inputText id="inputPosition"
							value="#{employeeBean.confidentialEmployeeDTO.position}"
							required="true" requiredMessage="Can't be blank"
							styleClass="inputEmployee" />
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputPosition" style="color:red" />

						<h:outputText value="CV:" style="float: right" />
						<h:inputFile id="uploadedFile" name="uploadFile"
							validator="#{employeeBean.validate}" />
						<h:outputText></h:outputText>
						<h:outputText value="#{employeeBean.errorMessage}" />

						<h:outputText value="Prosis number" style="float: right" />
						<h:inputText id="inputProsisNr"
							value="#{confidentialEmployeeDTO.prosisNr}" required="true"
							requiredMessage="Can't be blank" styleClass="inputEmployee">
						</h:inputText>
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputProsisNr" style="color:red" />

						<h:outputText value="Work phone" style="float: right" />
						<h:inputText id="inputWorkPhone" styleClass="inputEmployee"
							value="#{confidentialEmployeeDTO.workPhone}"
							validatorMessage="Phone number is not valid. It needs to be between 10 and 14 digits.">
							<f:validateRegex pattern="^\d{10,14}$" />
						</h:inputText>
						<h:outputText></h:outputText>
						<h:message for="inputWorkPhone" style="color:red" />

						<h:outputText value="German contact person" style="float: right" />
						<h:inputText id="inputGermanContactPerson"
							styleClass="inputEmployee"
							value="#{confidentialEmployeeDTO.germanContactPerson}"
							required="true" requiredMessage="Can't be blank" />
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputGermanContactPerson" style="color:red" />

						<h:outputText value="Career level" style="float: right" />
						<h:inputText id="inputCareerLevel" styleClass="inputEmployee"
							value="#{confidentialEmployeeDTO.careerLevel}" required="true"
							requiredMessage="Can't be blank" />
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputCareerLevel" style="color:red" />


						<h:outputText
							rendered="#{controllerBean.canViewEmployeeManagement()}"
							value="Base salary (€)" style="float: right"
							 />
						<h:inputText id="inputSalary" styleClass="inputEmployee"
							value="#{confidentialEmployeeDTO.salary}"
							rendered="#{controllerBean.canViewEmployeeManagement()}" />
						<h:outputText
							rendered="#{controllerBean.canViewEmployeeManagement()}"></h:outputText>
						<h:message for="inputSalary"
							rendered="#{controllerBean.canViewEmployeeManagement()}"
							style="color:red" />

						<h:outputText value="Salary variable part (€)"
							style="float: right"
							rendered="#{controllerBean.canViewEmployeeManagement()}" />
						<h:inputText id="inputVarPart" styleClass="inputEmployee"
							value="#{confidentialEmployeeDTO.varPart}"
							rendered="#{controllerBean.canViewEmployeeManagement()}" />
						<h:outputText
							rendered="#{controllerBean.canViewEmployeeManagement()}"></h:outputText>
						<h:message for="inputVarPart"
							rendered="#{controllerBean.canViewEmployeeManagement()}"
							style="color:red" />


						<h:outputText style="float: right"
							value="Select either team lead role, or employees team leader" />
						<h:selectOneMenu id="inputComboTeamLeader"
							value="#{employeeBean.selectedTeamLeaderId}" required="true"
							requiredMessage="Can't be blank">
							<f:selectItem itemValue="#{0}" itemLabel="Is team leader" />
							<f:selectItems value="#{employeeBean.teamLeaderList}" var="name"
								itemLabel="#{name.username}" itemValue="#{name.id}" />
						</h:selectOneMenu>
						<h:outputText></h:outputText>
						<h:message for="inputComboTeamLeader" style="color:red" />


						<h:outputText value="Department" style="float: right" />
						<h:selectOneMenu id="inputComboDepartment"
							value="#{employeeBean.selectedDepartmentId}" required="true"
							requiredMessage="Can't be blank">
							<f:selectItem itemValue="#{null}" itemLabel="-- select one --" />
							<f:selectItems value="#{employeeBean.departmentList}" var="name"
								itemLabel="#{name.name}" itemValue="#{name.id}" />
						</h:selectOneMenu>
						<h:outputText value="*" style="color:red"></h:outputText>
						<h:message for="inputComboDepartment" style="color:red" />


						<h:outputText value="Superior" style="float: right" />
						<h:selectOneMenu id="inputComboSuperior"
							value="#{employeeBean.selectedSuperiorId}" required="true"
							requiredMessage="Can't be blank">
							<f:selectItem itemValue="#{null}" itemLabel="-- select one --" />
							<f:selectItems value="#{employeeBean.superiorList}" var="name"
								itemLabel="#{name.username}" itemValue="#{name.id}" />
						</h:selectOneMenu>
						<h:outputText></h:outputText>
						<h:message for="inputComboSuperior" style="color:red" />


						<h:outputText value="Roles:" style="float: right" />
						<h:outputText />
						<h:outputText />
						<h:outputText></h:outputText>

						<h:outputText value="Basic user (library and review)"
							style="float: right" />
						<h:selectBooleanCheckbox id="inputBasicUser"
							value="#{employeeBean.basicUser}" />
						<h:outputText />
						<h:outputText></h:outputText>

						<h:outputText value="Administration" style="float: right" />
						<h:selectBooleanCheckbox id="inputAdministration"
							value="#{employeeBean.administration}" />
						<h:outputText />
						<h:outputText></h:outputText>

						<h:outputText value="Department Manager" style="float: right" />
						<h:selectBooleanCheckbox id="inputDepartmentLeader"
							value="#{employeeBean.departmentManager}" />
						<h:outputText value="#{employeeBean.departmentManagerMessage}" />
						<h:outputText></h:outputText>

						<h:outputText value="Library Admin" style="float: right" />
						<h:selectBooleanCheckbox id="inputLibraryAdmin"
							value="#{employeeBean.libraryAdmin}" />
						<h:outputText />
						<h:outputText></h:outputText>

						<h:outputText value="Accountant" style="float: right" />
						<h:selectBooleanCheckbox id="inputAccountant"
							value="#{employeeBean.accountant}" />
						<h:outputText />
						<h:outputText></h:outputText>

						<h:commandButton id="createUser" value="Save"
							action="#{employeeBean.addEmployee}">
							<f:param name="cicic" value="employee" />
						</h:commandButton>

					</h:panelGrid>

				</h:form>
			</h:panelGroup>
		</h:panelGroup>
	</h:panelGroup>
</h:body>
</html>